/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Comparator;
import java.util.function.UnaryOperator;

/**
 * <p>Project: javaseapp - Demo
 * <p>Powered by webrx On 2021-08-20 08:49:01
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Demo {
    public static void main(String[] args) {
        DbDao db = new DbDao() {
            public int pf(int i) {
                return i * i;
            }
        };

        System.out.println(db.pf(19));

        //使用了lambda 表达式，->
        var db2 = (DbDao) a -> a * a;
        DbDao db3 = e -> e * e;
        System.out.println(db2.pf(3));
        System.out.println(db3.pf(6));


        UnaryOperator<Integer> o = i -> i * i;
        System.out.println(o.apply(3));

        UnaryOperator<String> hello = (s) -> "hello:" + s;
        System.out.println(hello.apply("李四"));

        Comparator<Integer> c = Integer::compare;
        System.out.println(c.compare(1, 0));
    }
}
